import ActionTypes from '../config/ActionTypes';

const initState = {
    isLoading:{
        login:false
    }
}

const loginReducer = (state = initState, action) => {

    switch(action.type){
        case ActionTypes.LOGIN + ActionTypes.FETCH_LOADING_SUFFIX:
        {
            return {
                ...state,
                isLoading:{
                    login:true
                }
            };
        }
        break;
        case ActionTypes.LOGIN + ActionTypes.FETCH_SUCCESS_SUFFIX:
        {
            return {
                ...state,
                isLoading:{
                    login:false
                }
            };
        }
        break;
        case ActionTypes.LOGIN + ActionTypes.FETCH_ERROR_SUFFIX:
        {
            return {
                ...state,
                isLoading:{
                    login:false
                }
            };
        }
        break;
        default:
        {
            return state;
        }
        break;
    }
}

export default loginReducer;